#!/bin/bash
#VERIFICA SE O NUMERO SE EXISTE ARGUMENTOS

COMMAND="./trab2 < ../in-out-files/input3.txt"

if [ $# -gt 0 ]; then
NUMBER=15#$1
	echo "Starting testing"
	echo "Exec case 3"
	for ((i=1 ;i <=$NUMBER;i++))
	do
		START=$(date +%N)
		eval $COMMAND
		END=$(date +%N)
		DIFF=$((10#$END - 10#$START))
		DIFF=$(echo "scale=4;$DIFF /1000000000" | bc)

		echo "[$i] Programs time: $DIFF seconds"
		echo "$DIFF s" >> timeregister.tests
	done
	echo "FINISHED!";
else
	echo "Use '$0 <number_of_tests:int>'"
fi